import {
  getHoursBefore,
  getDayBefore,
  getWeekDayBefore,
  getMonthBefore,
  generateRandomValue
} from "./handler";

export const information = {
  testUnit: "巴平路",
  testPerson: "王富贵",
  testTime: "起2023-06-01 至 2024-01-20",
  testContent: "地表位移监测",
  testDescribe:
    "覆盖层为棕黄色粉质黏士，厚约3.4~6.9m，下伏一叠系百逢组二三段(T/2b2+3/) 黄褐色、灰黄色、青灰色薄~中厚层状全~强风化砂岩，全风化层已风化成土，夹泥岩，厚度约6m，强风化层岩体破碎，节理裂隙极发育。岩层产状: 242°243°，J1: 140°284°，J2: 42°245”; 组成边坡以强风化砂岩为主，厘于软质岩边坡。岩层倾向总体向外倾，属于顺向边坡，对边坡稳定不利。"
};

//智能环
export const smartRingData = {
  dataCost: [
    {
      name: "总数",
      value: "3124"
    },
    {
      name: "在线",
      value: "1224"
    },
    {
      name: "离线",
      value: "1311"
    },
    {
      name: "告警",
      value: "1311"
    }
  ],
  dataColor: ["#66D4D0", "#45B6DF", "#D4831E", "#D4491E"],
  dataImg: "/static/img/slope/smartRing.webp"
};

//摄像头
export const cameraData = {
  dataCost: [
    {
      name: "总数",
      value: "120"
    },
    {
      name: "在线",
      value: "84"
    },
    {
      name: "离线",
      value: "12"
    },
    {
      name: "告警",
      value: "24"
    }
  ],
  dataColor: ["#66D4D0", "#45B6DF", "#D4831E", "#D4491E"],
  dataImg: "/static/img/slope/camera.webp"
};

//太阳能板
export const solarPanelsData = {
  dataCost: [
    {
      name: "总数",
      value: "20"
    },
    {
      name: "在线",
      value: "18"
    },
    {
      name: "离线",
      value: "2"
    },
    {
      name: "告警",
      value: "0"
    }
  ],
  dataColor: ["#66D4D0", "#45B6DF", "#D4831E", "#D4491E"],
  dataImg: "/static/img/slope/solarPanels.webp"
};

/**告警处理-告警数量 */
export const alarData = () => {
  return {
    processed: 3,
    untreated: 0,
    total: 3,
  }
}

/**告警处理-告警数量 */
export const alarHistoryListData = () => {
  return [
    {
      id: "1",
      name: "智能环1",
      alarGrade: "2",
      alarInformation: "应力不足",
      time: "2024-01-30 21:07"
    },
    {
      id: "2",
      name: "智能环2",
      alarGrade: "2",
      alarInformation: "电压过低",
      time: "2024-01-30 21:07"
    },
    {
      id: "3",
      name: "智能环3",
      alarGrade: "2",
      alarInformation: "位移告警",
      time: "2024-01-30 21:07"
    },
    {
      id: "4",
      name: "智能环4",
      alarGrade: "0",
      alarInformation: "状况正常",
      time: "2024-01-30 21:07"
    },
    {
      id: "5",
      name: "智能环5",
      alarGrade: "1",
      alarInformation: "需要排障",
      time: "2024-01-30 21:07"
    },
    {
      id: "6",
      name: "智能环6",
      alarGrade: "1",
      alarInformation: "需要排障",
      time: "2024-01-30 21:07"
    },
    {
      id: "7",
      name: "智能环7",
      alarGrade: "1",
      alarInformation: "需要排障",
      time: "2024-01-30 21:07"
    }

  ]
}

/**设备弹出框 */
export const deviceListData = [
  {
    name: "钢筋计",
    number: "智能环1",
    stress: "254.0 KN",
    status: "离线",
    warn: "严重",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "智能环2",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "智能环3",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "智能环4",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "智能环5",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "智能环6",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "传感器1",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "传感器2",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "传感器3",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
  {
    name: "钢筋计",
    number: "传感器4",
    stress: "254.0 KN",
    status: "正常",
    warn: "-",
    time: "2024-1-24 12:00:00"
  },
]

/**
 * 监测趋势数据生成方法
 * @param {Object} key 传入筛选 key
 * @returns {Array<Object>} 返回工单数据
 */
export const generateMonitoringDataData = key => {
  const data = [];
  if (key == 0) {
    const timeList = getHoursBefore();
    timeList.forEach(time => {
      data.push({
        name: time,
        value: generateRandomValue(2)
      });
    });
  }

  if (key == 1) {
    const dayList = getWeekDayBefore();
    dayList.forEach(day => {
      data.push({
        name: day,
        value: generateRandomValue(2)
      });
    });
  }

  if (key == 2) {
    const monthList = getDayBefore();
    monthList.forEach(month => {
      data.push({
        name: month,
        value: generateRandomValue(3)
      });
    });
  }

  if (key == 3) {
    const monthList = getMonthBefore();
    monthList.forEach(month => {
      data.push({
        name: month,
        value: generateRandomValue(4)
      });
    });
  }

  return data;
};


/**边坡材料展示 */
export const dataDisplayData = () => {
  return [
    {
      id:"1",
      dataType:"建设方",
      company: "XXXXX公司",
      person:"负责人",
      name:"张三",
      url:"/static/img/slope/measurement-points.webp"
    },
    {
      id:"2",
      dataType:"监理方",
      company: "XXXXX公司",
      person:"负责人",
      name:"张三",
      url:"/static/img/slope/monitor1.webp"
    },
    {
      id:"3",
      dataType:"设计方",
      company: "XXXXX公司",
      person:"负责人",
      name:"张三",
      url:"/static/img/slope/monitor2.webp"
    },
    {
      id:"4",
      dataType:"总包方X",
      company: "XXXXX公司",
      person:"负责人",
      name:"张三",
      url:"/static/img/slope/backgrounWeather.webp"
    },
    {
      id:"5",
      dataType:"施工方",
      company: "XXXXX公司",
      person:"负责人",
      name:"张三",
      url:"/static/img/slope/边坡.pdf"
    },
    {
      id:"6",
      dataType:"相关资料",
      company: "资料入口",
      person:"展开详情",
      name:"详情入口",
      url:"/static/img/slope/边坡 - 副本.pdf"
    },
  ]

}
